<extend name="template/base_index" />

<block name="area_header">
	<link rel="stylesheet" type="text/css" media="all" href="__CSS__/wxshop.css">
	<link type="text/css" rel="stylesheet" src="__CDN__/jquery-uploadify/3.2.1/uploadify.css" />
	<script type="text/javascript" src="__CDN__/jquery-uploadify/3.2.1/jquery.uploadify.min.js"></script>

</block>

<block name="area_body">
	{:W('Menus/topbar')}
	<div class="admin-main container-fluid">
		{:W('Menus/left')}
		<div class="admin-main-content">
			{:W('Menus/breadcrumb')}
			<h4>当前店铺: <strong>{$store.name}</strong></h4>
			<!-- 过滤\查询按钮 -->
			<div class="filter-controls">
				<!-- 日期查询 -->
				<form action="{:U('Admin/Product/index')}" method="post" class="form-inline">
					<input type="hidden" name="store_id" value="{$store_id}" />
					<div class="form-group">
						<label>商品状态</label>
						<label class="radio-inline">
							<input type="radio" name="onshelf" value="1" class="onshelf" <eq name="onshelf" value="1">checked="checked"</eq> />已上架
						</label>
						<label class="radio-inline">
							<input type="radio" name="onshelf" value="0" class="onshelf" <eq name="onshelf" value="0">checked="checked"</eq>  />未上架
						</label>
					</div>
					<div class="form-group">
						<label>商品名称</label>
						<input type="text" name="name" class="form-control input-sm" value="{$name}" placeholder="请输入商品名称" />
					</div>
					<button type="submit" class="btn btn-default btn-sm" id="searchFormSubmit"><i class="fa fa-search"></i>{:L('BTN_SEARCH')}</button>
				</form>
			</div>
			<!-- 操作按钮 -->
			<div class="btn-controls">
				<a class="btn btn-primary btn-sm" href="{:U('Admin/Product/precreate',array('store_id'=>$store_id))}"><i class="fa fa-plus"></i>添加商品</a>
				
			</div>


			<table class="table table-striped table table-hover  table-condensed">
				<thead>
					<tr>
						<th>
							<input type="checkbox" class="selectall" onclick="myUtils.selectall(this,'.selectitem');" />ID
						</th>
						<th>
							商品名称
						</th>
						<th>
							商品设置
						</th>
						<th>
							操作
						</th>
					</tr>
				</thead>
				<tbody>
					<empty name="list">
						<tr>
							<td colspan="5" class="text-center">{:L('NO_DATA')}</td>
						</tr>
						<else/>
						<volist name="list" id="vo">
							<tr>
								<td>
									<input type="checkbox" value="{$vo.id}" name="ids[]" class="selectitem" />{$vo.id}</td>
								<td class="text-ellipsis">{$vo.name}<BR/>
                                    <a href="{:U('Admin/Product/view',array('imgId'=>$vo['main_img']))}" target="_blank" title="点击查看原图" data-toggle="tooltip">
									<img  class="thumbnail" src="{:U('Api/Picture/index',array('id'=>$vo['main_img'],'size'=>60))}" width="60"/></a>
								</td>
								<td>
									<a href="{:U('Admin/Product/group',array('id'=>$vo['id'],'store_id'=>$store_id))}" class="btn btn-sm btn-link">商品分组</a>
									
									<a href="{:U('Admin/Product/express',array('id'=>$vo['id'],'store_id'=>$store_id,'productid'=>$vo['product_id']))}" class="btn btn-sm btn-link">运费</a>
									<a href="{:U('Admin/Product/detail',array('id'=>$vo['id'],'store_id'=>$store_id,'productid'=>$vo['product_id']))}" class="btn btn-sm btn-link">商品详情</a>
									<a href="{:U('Admin/Product/sku',array('id'=>$vo['id']))}" class="btn btn-sm btn-link">商品规格<i title="规格一般指 颜色、款式等" class="fa fa-question" data-toggle="tooltip"></i></a></td>
								<td>
									<if condition="$vo['onshelf'] == 0" >
									<a href="{:U('Admin/Product/shelf',array('id'=>$vo['id'],'on'=>1))}" class="ajax-get btn btn-primary btn-sm"><i class="fa fa-arrow-up"></i>上架</a>
									<else/>										
									<a href="{:U('Admin/Product/shelf',array('id'=>$vo['id'],'on'=>0))}" class="ajax-get confirm btn btn-primary btn-sm"><i class="fa fa-arrow-down"></i>下架</a>
									</if>

                                    <a href="{:U('Admin/Product/putin',array('id'=>$vo['id']))}" class="btn btn-sm btn-primary"><i class="fa fa-edit"></i>库存管理</a>

                                    <a href="javascript:void(0)" class="btn btn-primary btn-sm" data-toggle="popover" data-placement="left" title="请复制如下地址：（再次点击隐藏）" data-content="{:C('SITE_URL')}/index.php/Shop/Index/spxq?id={$vo.id}"><i class="fa fa-cog fa-fw"></i>复制商品链接</a>

                                    <div class="btn-group">
                                        <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                            更多 <span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu">
                                            <li><a href="{:U('Admin/Product/edit',array('id'=>$vo['id'],'onshelf'=>$onshelf,'p'=>$p,'cate_id'=>$vo['cate_id']))}" class="btn btn-sm"><i class="fa fa-edit"></i>{:L('BTN_EDIT')}</a>
                                            </li>
                                            <li><a href="{:U('Admin/Product/delete',array('id'=>$vo['id'],'store_id'=>$vo['store_id']))}" class="btn btn-sm ajax-get confirm"><i class="fa fa-trash-o"></i>{:L('BTN_DELETE')}</a>
                                            </li>
                                        </ul>
                                    </div>

								</td>
							</tr>

						</volist>
					</empty>
				</tbody>
			</table>
			<div>{$show}</div>

		</div>
		<!-- END admin-main-content -->
	</div>
	<!-- END admin-main-->
</block>

<block name="area_footer">
	<script type="text/javascript">
	$(function(){
		$(".onshelf").click(function(){
			$("#searchFormSubmit").click();
		})
	})
	</script>
</block>